package chapter4;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

public class ButtonEvent2 extends ApplicationWindow{

	public ButtonEvent2() {
		super(null);
	}
	
	@Override
	protected Control createContents(Composite parent) {
		Button button = new Button(parent, SWT.PUSH | SWT.CENTER);
		
		MouseAdapter example = new MouseAdapter(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				System.out.println("double click ");
			}

			
		};
		
		button.addMouseListener(example);
		
		button.setText("luik2");
		
		return super.createContents(parent);
	}

	public static void main(String[] args) {
		ButtonEvent2 be1 = new ButtonEvent2();
		be1.setBlockOnOpen(true);
		be1.open();
		
		Display.getCurrent().dispose();
	}
}
